package com.tramy.cn.push.sender;

import com.tramy.cn.push.common.AuthInfo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SenderManager {

    private final Map<String, PushSender> senderMap;

    public SenderManager(List<AuthInfo> authInfos) {
        senderMap = new HashMap<>();

        for (AuthInfo authInfo : authInfos) {
            senderMap.put(authInfo.getPlatform(), SenderFactory.getInstance(authInfo));
        }
    }

    public PushSender getSender(String platform) {
        return senderMap.get(platform);
    }

}
